-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Feature/internal/sync map #2109
Conversation
Deploying with Cloudflare Pages
|
[CHATOPS:HELP] ChatOps commands.
|
type cache struct { | ||
gache gache.Gache | ||
type cache[V any] struct { | ||
gache gache.Gache[V] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶gache
is unused (structcheck)
@@ -36,7 +38,7 @@ type Group[V any] interface { | |||
} | |||
|
|||
type group[V any] struct { | |||
m sync.Map | |||
m valdsync.Map[string, *call[V]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶m
is unused (structcheck)
@@ -0,0 +1,7 @@ | |||
package sync | |||
|
|||
import gache "github.com/kpango/gache/v2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
import 'github.com/kpango/gache/v2' is not allowed from list 'Main' (depguard)
c.gache.StartExpired(ctx, c.expireCheckDur) | ||
} | ||
|
||
// Get calls StartExpired func of c.gache and returns (interface{}, bool) according to key. | ||
func (c *cache) Get(key string) (interface{}, bool) { | ||
func (c *cache[V]) Get(key string) (V, bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
Get returns interface (V) (ireturn)
c.gache.Delete(key) | ||
} | ||
|
||
// GetAndDelete returns (interface{}, bool) and delete value according to key when value of key is set. | ||
// When value of key is not set, returns (nil, false). | ||
func (c *cache) GetAndDelete(key string) (interface{}, bool) { | ||
func (c *cache[V]) GetAndDelete(key string) (V, bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
GetAndDelete returns interface (V) (ireturn)
@@ -554,7 +554,7 @@ func Test_cache_GetAndDelete(t *testing.T) { | |||
test := tc | |||
t.Run(test.name, func(tt *testing.T) { | |||
defer goleak.VerifyNone(tt, goleakIgnoreOptions...) | |||
c := &cache{ | |||
c := &cache[any]{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
variable name 'c' is too short for the scope of its usage (varnamelen)
@@ -119,7 +120,7 @@ func TestWithGache(t *testing.T) { | |||
|
|||
tests := []test{ | |||
func() test { | |||
ga := gache.New() | |||
ga := gache.New[any]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
variable name 'ga' is too short for the scope of its usage (varnamelen)
beforeFunc func(args) | ||
afterFunc func(args) | ||
} | ||
defaultCheckFunc := func(w want, c *cache) error { | ||
defaultCheckFunc := func(w want, c *cache[any]) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
parameter name 'w' is too short for the scope of its usage (varnamelen)
beforeFunc func(args) | ||
afterFunc func(args) | ||
} | ||
|
||
defaultCheckFunc := func(w want, got *cache) error { | ||
defaultCheckFunc := func(w want, got *cache[any]) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
parameter name 'w' is too short for the scope of its usage (varnamelen)
defaultCheckFunc := func(w want, got cacher.Cache) error { | ||
wc := reflect.ValueOf(w.wantC.(*cache)) | ||
gc := reflect.ValueOf(got.(*cache)) | ||
defaultCheckFunc := func(w want, got cacher.Cache[any]) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
parameter name 'w' is too short for the scope of its usage (varnamelen)
internal/sync/map.go
Outdated
import gache "github.com/kpango/gache/v2" | ||
|
||
type Map[K comparable, V any] struct { | ||
gache.Map[K,V] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
File is not gofumpt
-ed (gofumpt)
internal/net/dialer.go
Outdated
@@ -34,6 +34,7 @@ import ( | |||
"github.com/vdaas/vald/internal/observability/trace" | |||
"github.com/vdaas/vald/internal/safety" | |||
"github.com/vdaas/vald/internal/tls" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
File is not goimports
-ed (goimports)
@@ -454,7 +454,7 @@ func Test_cache_Delete(t *testing.T) { | |||
test := tc | |||
t.Run(test.name, func(tt *testing.T) { | |||
defer goleak.VerifyNone(tt, goleakIgnoreOptions...) | |||
c := &cache{ | |||
c := &cache[any]{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
variable name 'c' is too short for the scope of its usage (varnamelen)
@@ -360,7 +360,7 @@ | |||
if test.checkFunc == nil { | |||
checkFunc = defaultCheckFunc | |||
} | |||
c := &cache{ | |||
c := &cache[any]{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
variable name 'c' is too short for the scope of its usage (varnamelen)
afterFunc func(args) | ||
} | ||
defaultCheckFunc := func(w want, c *cache) error { | ||
defaultCheckFunc := func(w want, c *cache[any]) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
parameter name 'w' is too short for the scope of its usage (varnamelen)
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2109 +/- ##
==========================================
+ Coverage 29.89% 29.98% +0.09%
==========================================
Files 369 369
Lines 35091 35083 -8
==========================================
+ Hits 10489 10519 +30
+ Misses 24118 24083 -35
+ Partials 484 481 -3
☔ View full report in Codecov by Sentry. |
@@ -266,7 +266,7 @@ func Test_cache_Get(t *testing.T) { | |||
test := tc | |||
t.Run(test.name, func(tt *testing.T) { | |||
defer goleak.VerifyNone(tt, goleakIgnoreOptions...) | |||
c := &cache{ | |||
c := &cache[any]{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
variable name 'c' is too short for the scope of its usage (varnamelen)
continue with #2115 |
Description:
Related Issue:
Versions:
Checklist:
Special notes for your reviewer: